# -*- coding: utf-8 -*-
"""
@Project: base_python
@File: scrapetest.py
@Author: PC
@Date: 2025/04/29
@Description: 
"""
from urllib.request import urlopen
from bs4 import BeautifulSoup
from urllib.error import HTTPError
import lxml
import html5lib

try:
    html = urlopen('http://pythonscraping.com/pages/page1.html')
except HTTPError as e:
    print(e)
    print('HTTPError')
# bsObj = BeautifulSoup(html, 'lxml')
# bsObj = BeautifulSoup(html, 'html5lib')
bsObj = BeautifulSoup(html, 'html.parser')
print(bsObj.h1)
print(bsObj.body.h1)
print(bsObj.html.h1)
